import request from '@/utils/request'

// 校验管理员手机
export function checkAdminPhone(query) {
  return request({
    url: '/system/villageUser/checkAdminPhone',
    method: 'get',
    params: query
  })
}

// 校验用户手机
export function checkUserPhone(query) {
  return request({
    url: '/system/villageUser/checkUserPhone',
    method: 'get',
    params: query
  })
}

// 查询小区住户列表
export function listVillageUser(query) {
  return request({
    url: '/system/villageUser/list',
    method: 'get',
    params: query
  })
}

// 查询小区住户详细
export function getVillageUser(id) {
  return request({
    url: '/system/villageUser/' + id,
    method: 'get'
  })
}

// 新增小区住户
export function addVillageUser(data) {
  return request({
    url: '/system/villageUser',
    method: 'post',
    data: data
  })
}

// 修改小区住户
export function updateVillageUser(data) {
  return request({
    url: '/system/villageUser',
    method: 'put',
    data: data
  })
}

// 删除小区住户
export function delVillageUser(id) {
  return request({
    url: '/system/villageUser/' + id,
    method: 'delete'
  })
}

// 导出小区住户
export function exportVillageUser(query) {
  return request({
    url: '/system/villageUser/export',
    method: 'get',
    params: query
  })
}

// 用户访客码修改
export function changVisitCodeStatus(id, visitCode) {
  const data = {
    id,
    visitCode
  }
  return request({
    url: '/system/villageUser/changVisitCodeStatus',
    method: 'put',
    data: data
  })
}